﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="ListEstates.aspx.cs" Inherits="ListEstates" %>

<%@ Import Namespace="System.Collections.Generic" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .x-grid-custom .company-link
        {
            color: #0E3D4F;
        }
        
        
        .x-grid-custom .x-grid3-row-selected TD, .x-grid-custom .x-grid3-row-selected TD .company-link
        {
            color: White;
        }
    </style>
    <script type="text/javascript">
        var template = '<span style="color:{0};">{1}</span>';

        var change = function (value) {
            return String.format(template, (value > 0) ? "green" : "red", value);
        }

        var pctChange = function (value) {
            return String.format(template, (value > 0) ? "green" : "red", value + "%");
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <ext:Store ID="Store1" runat="server" OnRefreshData="Store1_RefreshData">
        <Reader>
            <ext:JsonReader>
                <Fields>
                    <ext:RecordField Name="estateId" />
                    <ext:RecordField Name="title" />
                    <ext:RecordField Name="roomCount" />
                    <ext:RecordField Name="isSale" />
                    <ext:RecordField Name="price" />
                    <ext:RecordField Name="m2" />
                    <ext:RecordField Name="type" />
                    <ext:RecordField Name="subType" />
                    <ext:RecordField Name="city" />
                    <ext:RecordField Name="town" />
                    <ext:RecordField Name="district" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" Title="Estate List"
        Width="790" Height="320">
        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:Column ColumnID="estateId" Header="Estate ID" DataIndex="estateId" />
                <ext:Column ColumnID="estateTitle" Header="Title" DataIndex="title" />
                <ext:Column Header="Room" DataIndex="roomCount" />
                <ext:Column ColumnID="isSaleColumn" Header="Sale/Rent" DataIndex="isSale" />
                <ext:Column Header="Price($)" DataIndex="price">
                    <Renderer Format="UsMoney" />
                </ext:Column>
                <ext:Column Header="m2" DataIndex="m2" />
                <ext:Column Header="Type" DataIndex="type" />
                <ext:Column Header="Sub Type" DataIndex="subType" />
                <ext:Column Header="City" DataIndex="city" />
                <ext:Column Header="Town" DataIndex="town" />
                <ext:Column Header="District" DataIndex="district" />
                <ext:CommandColumn Width="55">
                    <Commands>
                        <ext:GridCommand Icon="House" CommandName="Details">
                            <ToolTip Text="Details" />
                        </ext:GridCommand>
                        <ext:CommandSeparator />
                        <ext:GridCommand Icon="Delete" CommandName="Delete">
                            <ToolTip Text="Delete" />
                        </ext:GridCommand>
                    </Commands>
                </ext:CommandColumn>
            </Columns>
        </ColumnModel>
        <Listeners>
            <Command Handler="Ext.net.DirectMethods.viewEstate(command, record.data.estateId);" />
        </Listeners>
        <TopBar>
            <ext:Toolbar ID="Toolbar1" runat="server">
                <Items>
                    <ext:Button ID="Button1" runat="server" Text="Add" Icon="Add">
                        <Listeners>
                            <Click Handler="Ext.Msg.alert('Confirm', 'You Clicked Add');" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button2" runat="server" Text="Delete" Icon="Exclamation">
                        <Listeners>
                            <Click Handler="Ext.Msg.confirm('Delete Estate', 'Are you sure?');" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button3" runat="server" Text="View" Icon="User">
                        <Listeners>
                            <Click Handler="Ext.Msg.alert('Confirm', 'You Clicked View');" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button4" runat="server" Text="Details" Icon="Pencil">
                        <Listeners>
                            <Click Handler="Ext.Msg.alert('Confirm', 'You Clicked View');" />
                        </Listeners>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <SelectionModel>
            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
        </SelectionModel>
        <LoadMask ShowMask="true" />
        <BottomBar>
            <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="10" StoreID="Store1" />
        </BottomBar>
        <Items>
            
        </Items>
    </ext:GridPanel>
    <ext:Label ID="idshower" runat="server">
    </ext:Label>
    <ext:Label ID="Label1" runat="server">
            </ext:Label>
</asp:Content>
